/*****************************************************************************
* Keppe Messenger (KMP) Keppe Project-Team User Messaging System
* Copyright (C) 2013-2014 Keppe Project-Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

#ifndef KSERVERCHAT_H
#define KSERVERCHAT_H

#include <QTcpSocket>
#include <QLineEdit>
#include <QWidget>
#include "KGuiFw_shared.h"

namespace Ui {
class KServerChat;
}

class KGUIFWSHARED_EXPORT KServerChat : public QWidget
{
    Q_OBJECT

public:
    explicit KServerChat(QWidget *parent = 0);
    void appendTextToLineEdit(QLineEdit* lineedit,QString text);
    bool connectChat(QString serverIP, QString username);
    bool isUserKnown(QString username);
    QString getCustomNick(QString username);
    QString convertMessage(QString message);
    void doSocket(QTcpSocket *server);
    QString getTabName();
    int getTabID();
    void disconnectChat();
    void setSerial(QString serial);
    void setTabID(int tabID);
    void setTabName(QString tabName);
    ~KServerChat();

signals:
    void chatDisconnected();

private slots:
    void automaticLength();
    void disconnected();
    void readyRead();
    void sendMessage();
    void checkReadyRead();
    void on_cmdDisconnect_clicked();
    void on_txtMessageBox_returnPressed();
    void on_cmdSmiley_clicked();
    void addEvilSmiley();
    void addFriendlySmiley ();
    void addLaughtingSmiley();
    void addHahaSmiley();
    void addNormalSmiley();
    void addSadSmiley();
    void addAngrySmiley();
    void addCrySmiley();
    void on_cmdSend_clicked();

private:
    Ui::KServerChat *ui;
};

#endif // KSERVERCHAT_H

#ifndef UNIXNAME_H
#define UNIXNAME_H

class UnixName
{
public:
    QString getUnixName();
    QString getWindowsName(bool triggered);
    UnixName();
};

#endif // UNIXNAME_H
